package model

type QueryOption struct {
	depth           int                  // 子目录查询深度
	showVirtualFile bool                 // 是否展示虚拟扩展文件(物理不存在，但有元数据的占位文件)
	filter          func(*FileInfo) bool // 文件过滤函数，返回true时展示
}

func (option *QueryOption) SetDepth(depth int) *QueryOption {
	option.depth = depth
	return option
}

func (option *QueryOption) GetDepth() int {
	return option.depth
}

func (option *QueryOption) SetShowVirtualFile(b bool) *QueryOption {
	option.showVirtualFile = b
	return option
}

func (option *QueryOption) GetShowVirtualFile() bool {
	return option.showVirtualFile
}

func (option *QueryOption) SetFilter(fun func(*FileInfo) bool) *QueryOption {
	option.filter = fun
	return option
}

func (option *QueryOption) Filter(info *FileInfo) bool {
	return option.filter(info)
}

func GetDefaultOption() *QueryOption {
	return &QueryOption{
		depth:           0,
		showVirtualFile: false,
		filter: func(*FileInfo) bool {
			return true
		},
	}
}
